package com.summer.framework.admin.controller.rpc;

import com.summer.framework.common.entity.response.BooleanResponse;
import com.summer.framework.common.exception.admin.UserNameNotFoundException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther: 杨杰
 * @date: 2019/5/16 14:58
 * @description:
 */
@RestController
@RequestMapping("/api/test")
public class TestController {

    @GetMapping("/boolean")
    public boolean booleanTest(){
        return true;
    }

    @RequestMapping(value = "err")
    public BooleanResponse error() {
        throw new UserNameNotFoundException("业务异常错误信息");
    }

    @RequestMapping(value = "err2")
    public void error2() {
        throw new NullPointerException("手动抛出异常信息");
    }

    @RequestMapping(value = "err3")
    public int error3() {
        int a = 10 / 0;
        return a;
    }
}
